--- title: "3028. Ant on the Boundary" created: 2025-12-16 --- # 3028. Ant on the Boundary ## 题目 [**3028. Ant on the Boundary**](https://leetcode.com/problems/ant-on-the-boundary/) ![[image-e3b5afb4.png]] ## 思路分析 ![[image-3ed2d410.png]] ## 代码实现 ```java class Solution { public int returnToBoundaryCount(int[] nums) { int cur=0,cnt=0; for(int i=0;i